<?php

/*class myUser extends sfBasicSecurityUser
{
}*/
class myUser extends sfGuardSecurityUser
{
	public function getId()
  {
    return $this->getAttribute('user_id', null, 'sfGuardSecurityUser');
  }
	
 public function addArticleHistory(BlogArticle $article)
  {
    $ids = $this->getAttribute('article_history', array());
 
    if (!in_array($article->getId(), $ids))
    {
      array_unshift($ids, $article->getId());
 
      $this->setAttribute('article_history', array_slice($ids, 0, 5));
    }
  }
  
  public function getArticleHistory()
  {
    $ids = $this->getAttribute('article_history', array());
 
    if (!empty($ids))
    {
      return Doctrine_Core::getTable('BlogArticle')
        ->createQuery('a')
        ->whereIn('a.id', $ids)
        ->execute()
      ;
    }
 
    return array();
  }

public function resetArticleHistory()
  {
    $this->getAttributeHolder()->remove('article_history');
  }


}
